﻿<?
include("../config/header.php");
?>
<script type='text/javascript'>
	document.title = 'CSS压缩/格式化 —— 在线工具';
</script>
<div class="container">
	<div class="panel panel-primary">
		<div class="panel-heading"><h3 class="panel-title">CSS压缩/格式化</h3></div>
	</div>
	<div class="form-group">
		<textarea style="width:100%;height:450px;" id="codeText" name="codeText" class="form-control">
@charset "utf-8";
	@import url(/style/style.css);
	@font-face {
	font-family:dreamy;
	font-weight:bold;
	src:url(font.eot);
}
@fontdef url("test.pfr");
	.test {
	font:normal normal 400 12pt "宋体,Times New Roman,Century Gothic,Arial,Helvetica";
	filter:progid:dximagetransform.microsoft.alphaimageloader(src="black.jpg",sizingmethod="scale");
	background:#292929 url("black.jpg") repeat scroll 0px 0px;
	background-image:url("black.jpg");
	border-color:#ff0000 #00ff00 #0000ff #000000;
	background-color:#292929;
}
body {
	scrollbar-3dLight-Color:black;
	/*设置箭头和滚动条左侧和顶边的颜色*/
 scrollbar-Arrow-Color:white;
	/*设置滚动条上的箭头颜色*/
 scrollbar-Base-Color:black;
	/*设置滚动条的底色*/
 scrollbar-DarkShadow-Color:black;
	/*设置箭头和滚动条右侧和底边的颜色*/
 scrollbar-Face-Color:black;
	/*设置滚动条的表色*/
 scrollbar-Highlight-Color:white;
	/*设置箭头和滚动条左侧和顶边的颜色，以及滚动条的背景*/
 scrollbar-Shadow-Color:white;
	/*设置箭头和滚动条右侧和底边的颜色*/
 scrollbar-Track-Color:royalblue;
	/*设置滚动条的背景色 *注*此颜色值为"IE4+预命名颜色"*/
}</textarea>
	</div>
	<div class="form-group" align="center">
		<button onclick="$('codeText').value=code.A()" class="button button-rounded button-flat">压缩代码</button>
		<button onclick="$('codeText').value=code.B();" class="button button-rounded button-flat-primary">格式(多行)</button>
		<button onclick="$('codeText').value=code.C();" class="button button-rounded button-flat-action">格式(单行)</button>
		<button onclick="$('codeText').value=code.Z();" class="button button-rounded button-flat-highlight">还原代码</button>
		<button onclick="EmptyCss();" class="button button-rounded button-flat-caution">清空代码</button>
	</div>
</div>
<script type="text/javascript">
function $(id){return document.getElementById(id);}
function EmptyCss(){document.getElementById("codeText").value="";}
function codeZip(obj){
	this.S=function(){
		var code=obj.value;
		if(!this.codeZ||this.codeZ=="")this.codeZ=code;
		code=code.replace(/(\n|\t|\s)*/ig,'$1');
		code=code.replace(/\n|\t|\s(\{|\}|\,|\:|\;)/ig,'$1');
		code=code.replace(/(\{|\}|\,|\:|\;)\s/ig,'$1');
		return code;
	}
	this.A=function(){
		var code=this.S();
		return code;
	} 
	this.B=function(){
		var code=this.S();
		code=code.replace(/(\{)/ig,' $1');
		code=code.replace(/(\{|\;)/ig,'$1\n\t');
		code=code.replace(/\t*(\})/ig,'$1\n');
		code=code.replace(/(\*\/)/ig,'$1\n');
		return code;
	}
	this.C=function(){
		var code=this.S();
		code=code.replace(/(\})/ig,'$1\n');
		code=code.replace(/(\*\/)/ig,'$1\n');
		return code;
	} 
	this.Z=function(){
		return (this.codeZ)?this.codeZ:obj.value;
	}
	var my=this;
	obj.onkeydown=function(){
		my.codeZ="";	
	}
}
var code=new codeZip(document.getElementById('codeText'));
</script>
<div class="footer container" id="footer">
	<p>
		<span>Copyright &copy; 2010 - 2014 独狼. All Rights Reserved.</span>   
	</p>
</div>
<!--<script src="<?php echo $url;?>content/js/jquery.min.js"></script>
<script src="<?php echo $url;?>content/js/bootstrap.min.js"></script>-->
<script src="<?php echo $url;?>content/js/lonewolf.min.js"></script>
</body>
</html>
<?php
//include("../config/footer.php");
?>